import java.util.ArrayList;
/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Lenovo
 * Date: 2025-08-03
 * Time: 22:01
 */
//https://leetcode.cn/problems/top-k-frequent-words/submissions/649548027/
//给定一个单词列表 words 和一个整数 k ，返回前 k 个出现次数最多的单词。
//返回的答案应该按单词出现频率由高到低排序。如果不同的单词有相同出现频率， 按字典顺序 排序。
public class Test {
    public static void main(String[] args) {
        Fun fun=new Fun();
        String[] arr={"i","love","leetcode","i","love","coding"};
        ArrayList list=(ArrayList) fun.topKFrequent(arr,2);
        System.out.println(list.toString());
    }
}
